<%@page import="com.je180503.pojo.NewsType"%>
<%@page import="com.je180503.service.impl.NewsTypeServiceImpl"%>
<%@page import="com.je180503.service.NewsTypeService"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%

    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    String typeName=request.getParameter("typeName");

    String parentId=request.getParameter("parentId");


    NewsTypeService newsTypeService=new NewsTypeServiceImpl();

    NewsType newsType=new NewsType();

    newsType.setTypeName(typeName);
    newsType.setParentId(Integer.parseInt(parentId));

    if(newsTypeService.save(newsType)>0){
        out.print("<script>alert('添加数据成功!');window.location='add.jsp'</script>");
    }else{

        out.print("<script>alert('添加数据失败!');window.location='add.jsp'</script>");
    }
%>
